package com.chaodev.base.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 生成带有特定的前缀的编号
 */
public class CodeGenerateUtil {

    //生成培训课程编号的前缀
    public static final String PRE_TRAINING_CODE = "PX";

    //志愿者编号前缀
    public static final String PRE_VOLUNTEER_CODE = "ZYZ";


    public static String getNewEquipmentNoById(String equipmentType,Integer id){
        String newEquipmentNo = String.format(equipmentType + "%05d", id);
        return newEquipmentNo;
    }

    public static String getNewEquipmentNoByTime(String equipmentType){
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
        String timestamp = dateFormat.format(new Date());
        String uniqueCode = equipmentType + timestamp;
        return uniqueCode;
    }

}
